package com.hmall.util;

import com.hmall.config.SpringContextUtil;
import com.hmall.controller.ConstantController;
import org.springframework.beans.factory.annotation.Autowired;


//工具类
//根据环境配置的改变，动态改变前缀url
public class EnvUtil {

    public  String getPreUrl(String type) {
        String active = SpringContextUtil.getActiveProfile();
        String url = "";
        if ("dev".equals(active)) {
            if("order".equals(type)){
                url += ConstantController.devOrderUrl;
            }else if("manage".equals(type)){
                url += ConstantController.devManageUrl;
            }else if("hCloud".equals(type)){
                url += ConstantController.devHCloudUrl;
            }else{
                url = "请输入正确的类型";
            }
        }else if ("test".equals(active)) {
            if("order".equals(type)){
                url += ConstantController.testOrderUrl;
            }else if("manage".equals(type)) {
                url += ConstantController.testManageUrl;
            }else if("hCloud".equals(type)){
                url += ConstantController.testHCloudUrl;
            } else{
                url =  "请输入正确的类型";
            }
        }
        return url;
    }


}
